/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modelo.Controler;

import Model.Beans.Book;
import Model.Servicios.BookSrv;
import Model.Utilities.Constantes.BookState;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Manuel Lap
 */
public class StdntBookMgmtAction extends ActionSupport{
    
    private Book book = new Book();
    private List<Book> booksFound = new ArrayList<Book>();
    private BookSrv bookSrv = new BookSrv();
    private String criNombre;
    private String criAutor;
    private String criIsbn;
    private String criEditorial;
    private String criYear;
    private String criTags;
    
    public String registro(){
        getBook().setStatus(BookState.SOLICITADO);
        bookSrv.insert(book);
        return "SUCCESS";
    }
    
    public String buscar(){
        booksFound = bookSrv.getBookBy(criTags, criNombre, criAutor, criIsbn, criEditorial, criYear, 7);
        return "resultSearch";
    }

    public String busquedaForm(){
        return "form";
    }
    /**
     * @return the book
     */
    public Book getBook() {
        return book;
    }

    /**
     * @param book the book to set
     */
    public void setBook(Book book) {
        this.book = book;
    }

    /**
     * @return the criNombre
     */
    public String getCriNombre() {
        return criNombre;
    }

    /**
     * @param criNombre the criNombre to set
     */
    public void setCriNombre(String criNombre) {
        this.criNombre = criNombre;
    }

    /**
     * @return the criAutor
     */
    public String getCriAutor() {
        return criAutor;
    }

    /**
     * @param criAutor the criAutor to set
     */
    public void setCriAutor(String criAutor) {
        this.criAutor = criAutor;
    }

    /**
     * @return the criIsbn
     */
    public String getCriIsbn() {
        return criIsbn;
    }

    /**
     * @param criIsbn the criIsbn to set
     */
    public void setCriIsbn(String criIsbn) {
        this.criIsbn = criIsbn;
    }

    /**
     * @return the criEditorial
     */
    public String getCriEditorial() {
        return criEditorial;
    }

    /**
     * @param criEditorial the criEditorial to set
     */
    public void setCriEditorial(String criEditorial) {
        this.criEditorial = criEditorial;
    }

    /**
     * @return the criYear
     */
    public String getCriYear() {
        return criYear;
    }

    /**
     * @param criYear the criYear to set
     */
    public void setCriYear(String criYear) {
        this.criYear = criYear;
    }

    /**
     * @return the criTags
     */
    public String getCriTags() {
        return criTags;
    }

    /**
     * @param criTags the criTags to set
     */
    public void setCriTags(String criTags) {
        this.criTags = criTags;
    }

    /**
     * @return the booksFound
     */
    public List<Book> getBooksFound() {
        return booksFound;
    }

    /**
     * @param booksFound the booksFound to set
     */
    public void setBooksFound(List<Book> booksFound) {
        this.booksFound = booksFound;
    }
    
    
}
